chrome.system.display
Description: |
Use the system.display API to query display metadata.
|
Availability: |
Since Chrome 35.
|
Permissions: |
"system.display"
|
Summary
Types | |
---|---|
Bounds | |
Insets | |
Point | |
TouchCalibrationPair | |
DisplayMode | |
DisplayLayout | |
Methods | |
getInfo −
chrome.system.display.getInfo(object flags, function callback)
| |
getDisplayLayout −
chrome.system.display.getDisplayLayout(function callback)
| |
setDisplayProperties −
chrome.system.display.setDisplayProperties(string id, object info, function callback)
| |
setDisplayLayout −
chrome.system.display.setDisplayLayout(array of DisplayLayout layouts, function callback)
| |
enableUnifiedDesktop −
chrome.system.display.enableUnifiedDesktop(boolean enabled)
| |
overscanCalibrationStart −
chrome.system.display.overscanCalibrationStart(string id)
| |
overscanCalibrationAdjust −
chrome.system.display.overscanCalibrationAdjust(string id, Insets delta)
| |
overscanCalibrationReset −
chrome.system.display.overscanCalibrationReset(string id)
| |
overscanCalibrationComplete −
chrome.system.display.overscanCalibrationComplete(string id)
| |
showNativeTouchCalibration −
chrome.system.display.showNativeTouchCalibration(string id, function callback)
| |
startCustomTouchCalibration −
chrome.system.display.startCustomTouchCalibration(string id)
| |
completeCustomTouchCalibration −
chrome.system.display.completeCustomTouchCalibration(object pairs, Bounds bounds)
| |
clearTouchCalibration −
chrome.system.display.clearTouchCalibration(string id)
| |
setMirrorMode −
chrome.system.display.setMirrorMode(object info, function callback)
| |
Events | |
onDisplayChanged |
Types
Bounds
properties | ||
---|---|---|
integer | left |
The x-coordinate of the upper-left corner. |
integer | top |
The y-coordinate of the upper-left corner. |
integer | width |
The width of the display in pixels. |
integer | height |
The height of the display in pixels. |
Insets
properties | ||
---|---|---|
integer | left |
The x-axis distance from the left bound. |
integer | top |
The y-axis distance from the top bound. |
integer | right |
The x-axis distance from the right bound. |
integer | bottom |
The y-axis distance from the bottom bound. |
Point
Since Chrome 57.
properties | ||
---|---|---|
integer | x |
The x-coordinate of the point. |
integer | y |
The y-coordinate of the point. |
TouchCalibrationPair
Since Chrome 57.
properties | ||
---|---|---|
Point | displayPoint |
The coordinates of the display point. |
Point | touchPoint |
The coordinates of the touch point corresponding to the display point. |
DisplayMode
Since Chrome 52.
properties | ||
---|---|---|
integer | width |
The display mode width in device independent (user visible) pixels. |
integer | height |
The display mode height in device independent (user visible) pixels. |
integer | widthInNativePixels |
The display mode width in native pixels. |
integer | heightInNativePixels |
The display mode height in native pixels. |
double | (optional) uiScale |
Deprecated since Chrome 70. Use displayZoomFactor The display mode UI scale factor. |
double | deviceScaleFactor |
The display mode device scale factor. |
double | refreshRate |
Since Chrome 67. The display mode refresh rate in hertz. |
boolean | isNative |
True if the mode is the display's native mode. |
boolean | isSelected |
True if the display mode is currently selected. |
boolean | (optional) isInterlaced |
Since Chrome 74. True if this mode is interlaced, false if not provided. |
DisplayLayout
Since Chrome 53.
properties | ||
---|---|---|
string | id |
The unique identifier of the display. |
string | parentId |
The unique identifier of the parent display. Empty if this is the root. |
enum of "top" , "right" , "bottom" , or "left" |
position |
The layout position of this display relative to the parent. This will be ignored for the root. |
integer | offset |
The offset of the display along the connected edge. 0 indicates that the topmost or leftmost corners are aligned. |
Methods
getInfo
chrome.system.display.getInfo(object flags, function callback)
Requests the information for all attached display devices.
Parameters | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
object | (optional) flags |
Since Chrome 59. Options affecting how the information is returned.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function | callback |
The callback to invoke with the results. The callback parameter should be a function that looks like this: function(array of object displayInfo) {...};
|
getDisplayLayout
chrome.system.display.getDisplayLayout(function callback)
Since Chrome 53.
Requests the layout info for all displays. NOTE: This is only available to Chrome OS Kiosk apps and Web UI.
Parameters | |||||
---|---|---|---|---|---|
function | callback |
The callback to invoke with the results. The callback parameter should be a function that looks like this: function(array of DisplayLayout layouts) {...};
|
setDisplayProperties
chrome.system.display.setDisplayProperties(string id, object info, function callback)
Updates the properties for the display specified by |id|, according to the information provided in |info|. On failure, runtime.lastError will be set. NOTE: This is only available to Chrome OS Kiosk apps and Web UI.
Parameters | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
string | id |
The display's unique identifier. |
|||||||||||||||||||||||||||
object | info |
The information about display properties that should be changed. A property will be changed only if a new value for it is specified in |info|.
|
|||||||||||||||||||||||||||
function | (optional) callback |
Empty function called when the function finishes. To find out whether the function succeeded, runtime.lastError should be queried. If you specify the callback parameter, it should be a function that looks like this: function() {...};
|
setDisplayLayout
chrome.system.display.setDisplayLayout(array of DisplayLayout layouts, function callback)
Since Chrome 53.
Set the layout for all displays. Any display not included will use the default layout. If a layout would overlap or be otherwise invalid it will be adjusted to a valid layout. After layout is resolved, an onDisplayChanged event will be triggered. NOTE: This is only available to Chrome OS Kiosk apps and Web UI.
Parameters | ||
---|---|---|
array of DisplayLayout | layouts |
The layout information, required for all displays except the primary display. |
function | (optional) callback |
Empty function called when the function finishes. To find out whether the function succeeded, runtime.lastError should be queried. If you specify the callback parameter, it should be a function that looks like this: function() {...};
|
enableUnifiedDesktop
chrome.system.display.enableUnifiedDesktop(boolean enabled)
Since Chrome 46.
Enables/disables the unified desktop feature. If enabled while mirroring is active, the desktop mode will not change until mirroring is turned off. Otherwise, the desktop mode will switch to unified immediately. NOTE: This is only available to Chrome OS Kiosk apps and Web UI.
Parameters | ||
---|---|---|
boolean | enabled |
True if unified desktop should be enabled. |
overscanCalibrationStart
chrome.system.display.overscanCalibrationStart(string id)
Since Chrome 53.
Starts overscan calibration for a display. This will show an overlay on the screen indicating the current overscan insets. If overscan calibration for display |id| is in progress this will reset calibration.
Parameters | ||
---|---|---|
string | id |
The display's unique identifier. |
overscanCalibrationAdjust
chrome.system.display.overscanCalibrationAdjust(string id, Insets delta)
Since Chrome 53.
Adjusts the current overscan insets for a display. Typically this should either move the display along an axis (e.g. left+right have the same value) or scale it along an axis (e.g. top+bottom have opposite values). Each Adjust call is cumulative with previous calls since Start.
Parameters | ||
---|---|---|
string | id |
The display's unique identifier. |
Insets | delta |
The amount to change the overscan insets. |
overscanCalibrationReset
chrome.system.display.overscanCalibrationReset(string id)
Since Chrome 53.
Resets the overscan insets for a display to the last saved value (i.e before Start was called).
Parameters | ||
---|---|---|
string | id |
The display's unique identifier. |
overscanCalibrationComplete
chrome.system.display.overscanCalibrationComplete(string id)
Since Chrome 53.
Complete overscan adjustments for a display by saving the current values and hiding the overlay.
Parameters | ||
---|---|---|
string | id |
The display's unique identifier. |
showNativeTouchCalibration
chrome.system.display.showNativeTouchCalibration(string id, function callback)
Since Chrome 57.
Displays the native touch calibration UX for the display with |id| as display id. This will show an overlay on the screen with required instructions on how to proceed. The callback will be invoked in case of successful calibration only. If the calibration fails, this will throw an error.
Parameters | |||||
---|---|---|---|---|---|
string | id |
The display's unique identifier. |
|||
function | (optional) callback |
Optional callback to inform the caller that the touch calibration has ended. The argument of the callback informs if the calibration was a success or not. If you specify the callback parameter, it should be a function that looks like this: function(boolean success) {...};
|
startCustomTouchCalibration
chrome.system.display.startCustomTouchCalibration(string id)
Since Chrome 57.
Starts custom touch calibration for a display. This should be called when using a custom UX for collecting calibration data. If another touch calibration is already in progress this will throw an error.
Parameters | ||
---|---|---|
string | id |
The display's unique identifier. |
completeCustomTouchCalibration
chrome.system.display.completeCustomTouchCalibration(object pairs, Bounds bounds)
Since Chrome 57.
Sets the touch calibration pairs for a display. These |pairs| would be used to calibrate the touch screen for display with |id| called in startCustomTouchCalibration(). Always call |startCustomTouchCalibration| before calling this method. If another touch calibration is already in progress this will throw an error.
Parameters | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
object | pairs |
The pairs of point used to calibrate the display.
|
||||||||||||
Bounds | bounds |
Bounds of the display when the touch calibration was performed. |bounds.left| and |bounds.top| values are ignored. |
clearTouchCalibration
chrome.system.display.clearTouchCalibration(string id)
Since Chrome 57.
Resets the touch calibration for the display and brings it back to its default state by clearing any touch calibration data associated with the display.
Parameters | ||
---|---|---|
string | id |
The display's unique identifier. |
setMirrorMode
chrome.system.display.setMirrorMode(object info, function callback)
Since Chrome 65.
Sets the display mode to the specified mirror mode. Each call resets the state from previous calls. Calling setDisplayProperties() will fail for the mirroring destination displays. NOTE: This is only available to Chrome OS Kiosk apps and Web UI.
Parameters | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
object | info |
The information of the mirror mode that should be applied to the display mode.
|
|||||||||
function | (optional) callback |
Empty function called when the function finishes. To find out whether the function succeeded, runtime.lastError should be queried. If you specify the callback parameter, it should be a function that looks like this: function() {...};
|
Events
onDisplayChanged
Fired when anything changes to the display configuration.
addListener
chrome.system.display.onDisplayChanged.addListener(function callback)
Parameters | ||
---|---|---|
function | callback |
The callback parameter should be a function that looks like this: function() {...};
|